# -*- encoding: utf-8 -*-
'''
@File		:	calculator.py
@Time		:	2024/01/22 10:29:34
@Author		:	dan
@Description:	展示测试华为自带的计算器
'''


if __name__ == '__main__':
    import sys
    sys.path.append(".")
import matter
import matter.android

## 测试计算器 1 + 2 是否等于 3

@matter.test_case(name='测试计算器')
def test_calculator():
    # 点击
    matter.android.touch_by_id('digit_1')
    matter.android.touch_by_id('op_add')
    matter.android.touch_by_id('digit_2')
    matter.android.touch_by_id('eq')
    result_element = matter.android.find_element_by_id('formula')
    matter.assert_true(result_element['text'] == '3')


if __name__ == '__main__':
    matter.start(yml='demo/android/calculator.yml')